﻿using System;
using System.Net;
using System.Threading.Tasks;

namespace Update.Utils.Interfaces
{
    /// <summary>
    /// 网络操作帮助类接口
    /// </summary>
    public interface INetworkHelper
    {
        /// <summary>
        /// 下载文件
        /// </summary>
        /// <param name="url">下载地址</param>
        /// <param name="localPath">本地保存路径</param>
        /// <param name="progressCallback">进度回调</param>
        /// <returns>是否成功</returns>
        Task<bool> DownloadFileAsync(string url, string localPath, Action<long, long> progressCallback = null);

        /// <summary>
        /// 发送GET请求
        /// </summary>
        /// <param name="url">请求地址</param>
        /// <param name="headers">请求头</param>
        /// <returns>响应内容</returns>
        Task<string> HttpGetAsync(string url, WebHeaderCollection headers = null);

        /// <summary>
        /// 发送POST请求
        /// </summary>
        /// <param name="url">请求地址</param>
        /// <param name="data">POST数据</param>
        /// <param name="contentType">内容类型</param>
        /// <param name="headers">请求头</param>
        /// <returns>响应内容</returns>
        Task<string> HttpPostAsync(string url, string data, string contentType = "application/json", WebHeaderCollection headers = null);


    }
} 